import { defineStore } from "pinia";

export const useMenuStore = defineStore("menuStore", {
  state: () => ({
    menuList: [],
  }),
  persist: true, // 启用持久化
  getters: {
    menuGetter: (state) => state.menuList,
  },
  actions: {
    setData(list: any) {
      this.menuList.splice(0);
      this.menuList.push(...list);
    },
    clearMenu() {
      this.menuList.splice(0);
    },
  },
});
